import * as Service from '../services/login';

export default {
  namespace: 'login',
  state: {
    data: {
    },
  },
  reducers: {
    init(state, { payload: data }) {
      return { ...state, data };
    },
  },
  effects: {
    *login({ payload: values }, { call, put }) {
      const data = yield call(Service.query, values);
      yield put({ type: 'init', payload: data });
    },
  },
  subscriptions: {
    setup({ dispatch, history }) {  // eslint-disable-line
    },
  },
};
